/*
 * Copyright (c) 2006, 2023, webrx.cn All rights reserved.
 *
 */

package cn.webrx;

import java.util.Arrays;

/**
 * <p>Project: jse2303 - Str3
 * <p>Powered by webrx On 2023-07-17 14:03:28
 * <p>描述：<p>
 *
 * @author webrx [webrx@126.com]
 * @version 1.0
 * @since 17
 */
public class Str3 {
    public static void main(String[] args) {
        String s = "Hello，JAVA";
        System.out.println(s.toLowerCase());
        System.out.println(s.toUpperCase());
        System.out.println(s.length());
        //清除左右连续空格
        System.out.println("   java                    ".trim());
        System.out.println("   java                    ".strip());
        //清除左边连续空格
        System.out.println("   java                    ".stripLeading());
        //清除右边连续空格
        System.out.println("   java                    ".stripTrailing());

        //清除所有空格
        System.out.println("    hello java   my          ".replace(" ", ""));

        System.out.println("abc".concat("java").contains("java"));
        System.out.println("abc".concat("javamyjava").indexOf("java"));
        System.out.println("abc".concat("javamyjava").lastIndexOf("java"));

        String[] ss1 = "hello".split("");
        System.out.println(Arrays.toString(ss1));

        char[] ss2 = "hello".toCharArray();
        System.out.println(Arrays.toString(ss2));

        String[] ss3 = "java,php,pyhton,c,ruby,html".split(",");
        System.out.println(Arrays.toString(ss3));
        String ss4 = "index".substring(2);
        System.out.println(ss4);//dex

        String ss5 = "index".substring(2, 3);
        System.out.println(ss5);//d

    }
}
